package com.mh.jdbc.entity;

import java.io.Serializable;
import java.util.List;

public class IPage<T> implements Serializable{
	private static final long serialVersionUID = 1L;
	// 当前页
	private int curPage = 1;
	// 总页数
	private int totalpage =1;
	// 每页显示条数
	private int pageSize;
	//总记录数
	private int rows;
	//结果集
	private List<MBean> result;
	//url地址
	private String url = "";
	//条件对象
	private MBean  parmBean = null;
	//模糊条件字段
	private String likePro = "";
	public IPage() {
		this.curPage = 1;
		this.pageSize = 7;
	}
	public IPage(int curPage,int pageSize) {
		if(curPage < 1) curPage = 1;
		this.curPage = curPage;
		this.pageSize = pageSize;
	}
	public int getCurPage() {
		return curPage;
	}
	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public void setRows(int rows) {
		this.rows = rows;
		if(curPage > this.getTotalpage()) curPage = this.getTotalpage();
	}
	public int getTotalpage() {
		return (this.rows - 1)/this.pageSize + 1;
	}
	public int getPageSize() {
		return pageSize;
	}
	public int getRows() {
		return rows;
	}
	public int getStartRow() {
		return (this.curPage - 1)*this.pageSize;
	}
	public boolean isHasNext() {
		return (this.curPage + 1 < this.totalpage) ? true : false;
	}
	public boolean isHasPrevious() {
		return (this.curPage - 1 > 0) ? true : false;
	}
	public List<MBean> getResult() {
		return result;
	}
	public void setResult(List<MBean> result) {
		this.result = result;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public MBean getParmBean() {
		return parmBean;
	}
	public void setParmBean(MBean parmBean) {
		this.parmBean = parmBean;
	}
	public String getLikePro() {
		return likePro;
	}
	public void setLikePro(String likePro) {
		this.likePro = likePro;
	}
}
